<!--  -->
<template>
  <div>
    <!-- <el-button type="primary" plain @click="dialogTableVisible = true">添加用户</el-button>
    <el-dialog :visible.sync="dialogTableVisible" title="添加用户">
      <el-form :model="user">
        <el-form-item label="姓名" :label-width="formLabelWidth">
          <el-input v-model="user.uname" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="密码" :label-width="formLabelWidth">
          <el-input v-model="user.upwd" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="联系方式" :label-width="formLabelWidth">
          <el-input v-model="user.utele" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="类型" :label-width="formLabelWidth">
          <el-select v-model="user.utype" placeholder="请选择状态">
            <el-option label="会员" value="1"></el-option>
            <el-option label="普通用户" value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="会员结束时间" :label-width="formLabelWidth">
          <el-date-picker
            v-model="user.endday"
            type="datetime"
            placeholder="选择日期时间"
            value-format="yyyy-MM-dd hh:mm:ss">
            </el-date-picker>
        </el-form-item>
        <el-form-item label="余额" :label-width="formLabelWidth">
          <el-input v-model="user.umoney" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel()">取 消</el-button>
        <el-button type="primary" @click="addUser()">确 定</el-button>
      </div>
    </el-dialog> -->
    <!-- 修改 -->
    <!-- <el-dialog :visible.sync="dialogFormVisible4Edit" title="修改订单">
      <el-form :model="ordered">
        <el-form-item label="订单id" :label-width="formLabelWidth">
          <el-input v-model="ordered.oid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="订单状态" :label-width="formLabelWidth">
          <el-input v-model="ordered.upwd" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="联系方式" :label-width="formLabelWidth">
          <el-input v-model="ordered.utele" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="类型" :label-width="formLabelWidth">
          <el-select v-model="ordered.utype" placeholder="请选择状态">
            <el-option label="会员" value="1"></el-option>
            <el-option label="普通用户" value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="余额" :label-width="formLabelWidth">
          <el-input v-model="ordered.umoney" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel()">取 消</el-button>
        <el-button type="primary" @click="modifyOrder()">确 定</el-button>
      </div>
    </el-dialog> -->

    <el-table :data="Money.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%">
      <el-table-column prop="amid" label="序号" width="150%">
      </el-table-column>
      <el-table-column prop="money" label="收益数目" width="150%">
      </el-table-column>
      <el-table-column prop="note" label="收益备注" width="255%">
      </el-table-column>
      <el-table-column prop="atime" label="收益时间" width="200%" >
      </el-table-column>
    </el-table>
    <!--分页区域-->
  <el-pagination
      @size-change="size_change" 
      @current-change="current_change"  
      :current-page="currentPage"  
      :page-sizes="[2,3,5]"  
      :page-size="pagesize"  
      layout="total, sizes, prev, pager, next, jumper"  
      :total="Money.length"> 
  </el-pagination>
  </div>


</template>
<script >
const axios = require("axios");
axios.defaults.baseURL = '/api/'
export default {
  data() {
    return {
      Money: [],
      // //添加用户
      // dialogTableVisible: false,
      // //修改用户
      // dialogFormVisible4Edit:false,
      Money:{
        aid:'',
        money: '',
        note:'',
        atime:''
      },
      formLabelWidth: '120px',
       total:0,//总条目数
        pagesize:10,//每页显示条目个数
        currentPage:1,//当前页数
    }
  },
  props: [],
  components: {},
  created() {
    this.findAll();
    this.size_change(5);
  },
  mounted() {
  },
  methods: {
    findAll() {
      axios.get('/amoney/getAMoneyList').then(res => {
        this.Money = res.data;
        console.log(res.data);
      })
    },
     size_change(newSize){
       this.pagesize = newSize
   },
   //监听 页码值 改变的事件
   current_change(newPage){
       this.currentPage = newPage
   },
    // cancel: function () {
    //   this.$message.info("当前操作已取消")
    //   this.dialogTableVisible = false,
    //   this.dialogFormVisible4Edit=false
    // },
    // addUser: function () {
    //   console.log(this.user.startday);
    //   axios({
    //     method: 'POST',
    //     url: '/users/addUsers',
    //     data: this.user
    //   })
    //     .then((resp) => {
    //       this.dialogTableVisible = false;
    //       this.$message.success("添加成功");
    //       this.findAll();
    //     })
    // },
    // updateUser: function(users){
    //   this.ordered=users;
    //   this.dialogFormVisible4Edit=true
    // },
    // modifyUser: function(){
    //   axios({
    //     method:'PUT',
    //     url:'/users/updateUsers',
    //     data: this.ordered
    //   }).then(res=>{
    //     this.dialogFormVisible4Edit=false,
    //     this.$message.success("修改成功");
    //     this.findAll();
    //   })
    // },
    // deleteMoney: function (Money) {
    //   console.log(Money.oid);
    //   axios({
    //     method: 'delete',
    //     url: '/Money/deleteMoney/' + Money.lid,
    //   })
    //     .then((res) => {
    //       this.$message.success('删除成功');
    //       this.findAll();
    //     })
    // }



  }
};
</script>
<style lang='scss'>
</style>